package com.efei.jdbc.sql;

public class SqlColumn {

    private String name;

    private String alis; //占位符号别名

    private Object value;

    private String parmeterType; // 参数值的类型

    SqlColumn(){

    }
    public static SqlColumn of(String name) {
        SqlColumn sc = new SqlColumn();
        sc.name = name;
        return sc;
    }

    public static SqlColumn of(String name, Object value) {
        SqlColumn sc = new SqlColumn();
        sc.name = name;
        sc.value=value;
        sc.setAlis(name);
        return sc;
    }

    public static SqlColumn of(String name, Object value, String parmeterType) {
        SqlColumn sc = new SqlColumn();
        sc.name = name;
        sc.value = value;
        sc.parmeterType = parmeterType;
        sc.setAlis(name);
        return sc;
    }

    public static SqlColumn of(String name, String alis, Object value) {
        SqlColumn sc = new SqlColumn();
        sc.name = name;
        sc.alis = alis;
        sc.value=value;
        return sc;
    }

    public static SqlColumn of(String name, String alis, Object value, String parmeterType) {
        SqlColumn sc = new SqlColumn();
        sc.name = name;
        sc.alis = alis;
        sc.value=value;
        sc.parmeterType = parmeterType;
        return sc;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Object getValue() {
        return value;
    }

    public void setValue(Object value) {
        this.value = value;
    }

    public String getParmeterType() {
        return parmeterType;
    }

    public void setParmeterType(String parmeterType) {
        this.parmeterType = parmeterType;
    }

    public void setAlis(String alis) {
        if(alis.indexOf(".")>-1) {
            this.alis = alis.replace(".", "_");
        } else {
            this.alis = alis;
        }
    }

    public String getAlis() {
        return this.alis;
    }
}
